﻿<div class="easyui-layout" data-options="fit:true,border:false" style="overflow:hidden;padding:0;margin:0px auto">
		<div data-options="region:'center',border:false">
			 <table cellspacing="10px" cellpadding="2px">
			     <tr><td>当前日期:</td><td><span id="pm_copy_current_date"></span></td></tr>
			     <tr><td>选择复制周:</td><td><input id="pm_title_copy_combox" name="copycombox" style="width:200px" size="45"></td></tr>
			 </table>
		</div>
	</div>
<script type="text/javascript">
var pm_title_copy_combox;
var current_oval_date_str = formatCalendarDate(new Date(),'-');
$(function(){
    $('#pm_copy_current_date').html(current_oval_date_str);
    getFourWeekData();
});

/**
	 * 调用job获取数据
	 * 
	 */
	function getFourWeekData() {
        var variable = new Array('__methodName', '__token', 'pagename', 'actionname','__params');
		var value = new Array('wsActionJSON', token, 'p_visitplanweekcopy', 'copyweek',"{'currentdate':'"+current_oval_date_str+"'}");
		var dataStr = getJsonData(variable, value);
		connectionServlet(dataStr, getFourWeekDataReturn);
	}
	/**
	 * 获取数据回调函数
	 */
	function getFourWeekDataReturn(data) {
		var tempResult,rowsData,rowsDataStr='';
		if (data.successflag == 'false') {
			return;
		}
		tempResult = data.result;
		if (typeof(tempResult) == 'undefined') {
			return;
		}
		if (typeof(tempResult.fourweek) != 'undefined') {
			var rowsData_temp = tempResult.fourweek;
			rowsData_temp_start = rowsData_temp.weekstart.split(",");
			rowsData_temp_end = rowsData_temp.weekend.split(",");
			for(var i=0;i< rowsData_temp_start.length;i++){
			     if( i > 0 ){
				     rowsDataStr +=",";
				 }
				  rowsDataStr +='{"id":'+(i*7)+',"text":"' + rowsData_temp_start[i] + ' 至 ' + rowsData_temp_end[i] +'"}';
			}
			rowsDataStr = "["+rowsDataStr+"]" ;
			rowsData = $.parseJSON(rowsDataStr);
		} else {
			rowsData = [];
		}
		pm_title_copy_combox = $('#pm_title_copy_combox').combobox({
			valueField:'id',   
			textField:'text',
			panelWidth:200,
			panelHeight:'auto',
			editable:false,
			data:rowsData
	   });
	  pm_title_copy_combox.combobox('setValue', '0');

	}

</script>
